package com.teach;

/**
 * <pre>
 * -
 * Author : J.L.Zhou
 * E-Mail : 2233875735@qq.com
 * Tel : 151 1104 7708
 * Date : 2021-04-13 10:45
 * Version : 1.0
 * Copyright 2021 jlzhou.top Inc. All rights reserved.
 * Warning: this content is only for internal circulation of the company.
 *          It is forbidden to divulge it or use it for other commercial purposes.
 * </pre>
 **/
public class Demo03 {
  public static void main(String[] args) {
    String str1 = "abc.bcd.cde";
    String str2 = "abc.BCD.cde";
    System.out.println(str1==str2);//false =比较是否是同一个对象
    System.out.println(str1.equals(str2));//false 内容不相同
    System.out.println(str1.equalsIgnoreCase(str2));//true ,忽略大小写
    System.out.println("a".compareTo("b"));//-1 'a'-'b'
    System.out.println("b".compareTo("a"));//1 'b'-'a'
    System.out.println("abc".compareTo("abd"));//-1
    System.out.println("abc".compareTo("abz"));//-23
    System.out.println("abc".compareTo("ab"));//1
    System.out.println("abc".compareTo("abcd"));//-1
    System.out.println("abc".compareTo("abdc"));//-1

    System.out.println(str1.contains("bc"));//true
    System.out.println(str1.matches(".*bc.*"));

    System.out.println(str1.startsWith("abc"));//true
    System.out.println(str1.matches("^abc.*"));
    System.out.println(str1.endsWith(".bcd"));//false
    System.out.println(str1.matches(".*\\.bcd$"));

    System.out.println("".isEmpty());
    System.out.println(str1.isEmpty());
    String str3 = null;
//    System.out.println(str3.isEmpty());
//    System.out.println(str3.equals(""));
    System.out.println("".equals(str3));
    //判断是否是null,或者"";
    System.out.println(str3==null||"".equals(str3));
    System.out.println(str3==null||"".equals(str3.trim()));

  }
}
